/*
*
*
* */
Rsd.define('Rsd.Faith.dialogs.FiscalDTShengHeDialog', {
    extend: 'Rsd.view.MajorSubDialog',
    requires: ['Rsd.controlEx.ModelViewer','Rsd.controlEx.ComboBoxEnum'],
    xtype:'dtjiaocun-shenghe-dialog',
    width:1100,
    height:800,
    title:'电梯、消防设备专项资金缴存审核',
    major:{
        legend:'',
        header:{content:'&nbsp发票信息',position:'top',height:40,align:'left',width:'100%'},
        height:130,
        readOnly:false,
        fields:[
            {label:{content:'发票编号',width:100},width:350,dataIndex:'FaPiaoBianHao',tabIndex:0},
            {label:{content:'开票内容',width:100},width:350,dataIndex:'KaiPiaoXiangMu',tabIndex:1},
            {label:{content:'发票金额',width:100},width:350,dataIndex:'FaPiaoJinE',tabIndex:2},
            {label:{content:'开票人',width:100},width:350,dataIndex:'CaoZuoYuanHao',tabIndex:3},
            {label:{content:'开票日期',width:100},width:350,dataIndex:'JiaoNaRiQi',tabIndex:4},
            {xtype:'combobox-enum',enum:'ShouFei_BiaoZhun_DT',label:{content:'缴费标准',width:100},width:350,dataIndex:'ShouFeiBiaoZhun',tabIndex:5}
        ]
    },
    sub: {
        label: {content: '&nbsp&nbsp&nbsp&nbsp ★ 请在下方银行账户列表中，选择缴存款项到账的银行账户；如需要的账户不存在，可到【银行账户】页面添加。👇'},
        fk: 'fph',
        height: 200,
        columns: [
            {
                "name":"isSelect",
                text:'选择',
                "width": 100,
                multiple:false,
                xtype: 'checkbox'
            },
            {
                "text": "序号",
                "xtype": "index",
                "width": 40,
                "index": 0
            },
            {
                "name": "KaiHuMingCheng",
                "dataIndex": "KaiHuMingCheng",
                "sortable": false,
                "text": "账户名称",
                "index": 4,
                "exist": true,
                "xtype": "string",
                "width": 150,
                "nobr": true
            },
            {
                "name": "KaiHuXingMingCheng",
                "dataIndex": "KaiHuXingMingCheng",
                "sortable": false,
                "text": "开户行名称",
                "index": 1,
                "exist": true,
                "xtype": "string",
                "width": 150,
                "nobr": true
            },

            {
                "name": "KaiHuZhangHao",
                "dataIndex": "KaiHuZhangHao",
                "sortable": false,
                "text": "银行账号",
                "index": 3,
                "exist": true,
                "xtype": "string",
                "width": 250,
                "nobr": true
            },


            {
                "name": "ZhangHuLeiXing",
                "dataIndex": "ZhangHuLeiXing",
                "sortable": false,
                "text": "账户类型",
                "index": 6,
                "exist": true,
                "xtype": "enum",
                enum:'ZhangHu_LeiXing',
                "width": 100,
                "nobr": true
            },
            {
                "name": "Remark",
                "dataIndex": "Remark",
                "sortable": false,
                "text": "备注",
                "index": 200,
                "exist": true,
                "xtype": "string",
                "width": 150,
                "nobr": true
            },
            {
                name: 'space',
                text: '',
                xtype: 'template',
                width: 5,
                hideable: false,
                sortable: false
            }

        ]
    },
    footer:{
        height:80,style:{fontSize:'120%',left:'50px'},
        items:[
            {
                xtype:'button',height:40,width:500,text:'Ⓢ发票款项已到账',handler:'btn_ok',
                height:40,label:{content:'请核实银行到账金额与【发票金额】是否一致。',style:{color:'red',lineHeight:'40px'},position:'right',width:350}
            }
        ]
    },
    /*
     *
     * */
    constructor: function constructor(config) {
        config = config || {};
        this.apply(config);

    },
    load:function load(data) {

        var me = this;
        var _data = this.data = data;
        var _store = Rsd.create('Rsd.Faith.stores.BizStore',{modelType:Rsd.app.assembelyName + '.BankYinHangZhangHuBiaoModel'});
        _store.load({ where:[{name:'ZhangHuLeiXing',op:'like',value:'061'}]},function load(list) {

            if(list.success)
            {
                me.subList = list.data.rows;
                me.callParent(_data,list.data.rows);
            }

            return true;
        });


    },
    btn_ok:function btn_ok() {

        var me = this;
        var _zhangHao = null;
        for(var i in this.subList)
        {
            if(this.subList[i]['isSelect'])
            {
                _zhangHao = this.subList[i];
            }

        }
        if(_zhangHao)
        {
            $yesOrNo('您确认款项（'+Rsd.formatCurrency(this.data['FaPiaoJinE'],'¥')+'元）已到账？\r\n账户:'+ _zhangHao['KaiHuXingMingCheng']+'('+_zhangHao['KaiHuZhangHao']+')',function () {
                Rsd.popup('确认成功');
                me.close();
            });

        }
        else
        {
            $msg('请选择发票款项入账银行账户。');
        }

    }

});